﻿using System;
using System.Collections.Generic;
using System.Linq;

public class EmailMessageOutput
{
    /// <summary>
    /// 邮件唯一标识（IMAP的UniqueId或POP3的索引）
    /// </summary>
    public string Id { get; set; } = string.Empty;

    /// <summary>
    /// 邮件主题
    /// </summary>
    public string Subject { get; set; } = string.Empty;

    /// <summary>
    /// 发件人
    /// </summary>
    public string From { get; set; } = string.Empty;

    /// <summary>
    /// 发件人地址（仅邮箱）
    /// </summary>
    public string FromAddress { get; set; } = string.Empty;

    /// <summary>
    /// 发件人名称
    /// </summary>
    public string FromName { get; set; } = string.Empty;

    /// <summary>
    /// 收件人（多个收件人用分号分隔）
    /// </summary>
    public string To { get; set; } = string.Empty;

    /// <summary>
    /// 收件人列表
    /// </summary>
    public List<MailAddress> ToList { get; set; } = new List<MailAddress>();

    /// <summary>
    /// 抄送人
    /// </summary>
    public string Cc { get; set; } = string.Empty;

    /// <summary>
    /// 密送人
    /// </summary>
    public string Bcc { get; set; } = string.Empty;

    /// <summary>
    /// 邮件日期
    /// </summary>
    public DateTime Date { get; set; }

    /// <summary>
    /// 纯文本正文
    /// </summary>
    public string TextBody { get; set; } = string.Empty;

    /// <summary>
    /// HTML格式正文
    /// </summary>
    public string HtmlBody { get; set; } = string.Empty;

    /// <summary>
    /// 是否已读
    /// </summary>
    public bool IsRead { get; set; }

    /// <summary>
    /// 是否重要
    /// </summary>
    public bool IsImportant { get; set; }

    /// <summary>
    /// 是否有附件
    /// </summary>
    public bool HasAttachments { get; set; }

    /// <summary>
    /// 邮件大小（字节）
    /// </summary>
    public long Size { get; set; }

    /// <summary>
    /// 附件列表
    /// </summary>
    public List<EmailAttachment> Attachments { get; set; } = new List<EmailAttachment>();

    /// <summary>
    /// 邮件文件夹（IMAP）
    /// </summary>
    public string Folder { get; set; } = "INBOX";

    /// <summary>
    /// 邮件标签/标记
    /// </summary>
    public List<string> Labels { get; set; } = new List<string>();

    /// <summary>
    /// 邮件头信息
    /// </summary>
    public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();

    /// <summary>
    /// 邮件消息ID（Message-Id头）
    /// </summary>
    public string MessageId { get; set; } = string.Empty;

    /// <summary>
    /// 回复邮件的MessageId
    /// </summary>
    public string InReplyTo { get; set; } = string.Empty;

    /// <summary>
    /// 邮件优先级
    /// </summary>
    public EmailPriority Priority { get; set; } = EmailPriority.Normal;
}

/// <summary>
/// 邮件优先级
/// </summary>
public enum EmailPriority
{
    Low = 0,
    Normal = 1,
    High = 2
}